HAL RTC time and date functions migration

This section provides information about the HAL RTC time and date functions migration.

Note

The RTC handle is removed in HAL2, so for the following RTC HAL2 functions, the handle will be removed from the parameters.

Related concept: Other HAL RTC changes

HAL RTC set time

HAL1

HAL2

HAL_StatusTypeDef HAL_RTC_SetTime(RTC_HandleTypeDef *hrtc,
                                  RTC_TimeTypeDef *sTime,
                                  uint32_t Format)
hal_status_t HAL_RTC_CALENDAR_SetTime(const hal_rtc_time_t *p_time)

HAL RTC get time

HAL1

HAL2

HAL_StatusTypeDef HAL_RTC_GetTime(const RTC_HandleTypeDef *hrtc,
                                  RTC_TimeTypeDef *sTime,
                                  uint32_t Format)
hal_status_t HAL_RTC_CALENDAR_GetTime(hal_rtc_time_t *p_time)

HAL RTC set date

HAL1

HAL2

HAL_StatusTypeDef HAL_RTC_SetDate(RTC_HandleTypeDef *hrtc,
                                  RTC_DateTypeDef *sDate,
                                  uint32_t Format)
hal_status_t HAL_RTC_CALENDAR_SetDate(const hal_rtc_date_t *p_date)

HAL RTC get date

HAL1

HAL2

HAL_StatusTypeDef HAL_RTC_GetDate(const RTC_HandleTypeDef *hrtc,
                                  RTC_DateTypeDef *sDate,
                                  uint32_t Format)
hal_status_t HAL_RTC_CALENDAR_GetDate(hal_rtc_date_t *p_date)

HAL RTC DST add1Hour

HAL1

HAL2

void HAL_RTC_DST_Add1Hour(const RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_CALENDAR_AddOneHour(void)

HAL RTC DST sub1Hour

HAL1

HAL2

void HAL_RTC_DST_Sub1Hour(const RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_CALENDAR_SubtractOneHour(void)

HAL RTC DST set store operation

HAL1

HAL2

void HAL_RTC_DST_SetStoreOperation(const RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_CALENDAR_EnableSummerTimeMemorization(void)

HAL RTC DST clear store operation

HAL1

HAL2

void HAL_RTC_DST_ClearStoreOperation(const RTC_HandleTypeDef *hrtc)
hal_status_t HAL_RTC_CALENDAR_DisableSummerTimeMemorization(void)

HAL RTC DST read store operation

HAL1

HAL2

uint32_t HAL_RTC_DST_ReadStoreOperation(const RTC_HandleTypeDef *hrtc)
hal_rtc_calendar_summer_time_status_t HAL_RTC_CALENDAR_IsEnabledSummerTimeMemorization(void)

Related use cases: HAL RTC calendar use case